﻿<%@ Page Language="C#"  MasterPageFile="~/MasterPage.master" AutoEventWireup="true" Inherits="Nivdal.ListOfTeamMatches" Title=""
    StylesheetTheme="SkinFile" Codebehind="ListOfTeamMatches.aspx.cs" %>

<%@ Register Assembly="obout_Flyout2_NET" Namespace="OboutInc.Flyout2" TagPrefix="cc1" %>
    
<asp:Content ID="HeadContent" runat="server" ContentPlaceHolderID="HeadPlaceHolder">
    <script type="text/javascript" language="javascript">
//        function ConfirmSelected(ddlname) {
//            var ddl = document.getElementById(ddlname);
//            var selectedValue = ddl.options[ddl.selectedIndex].innerHTML;
//            var Prefixx = "ctl00_ctl00_ContentPlaceHolder3_ContentPlaceHolder1_";
//            var message = document.getElementById(Prefixx + "AreYousureAssign1").value + " " + selectedValue + document.getElementById(Prefixx + "AreYousureAssign2").value;
//            alert(confirm(message));
//            return confirm(message);
//        }

    </script>
</asp:Content>
<asp:Content ID="PageNameContent" ContentPlaceHolderID="PageNamePlaceHolder" runat="server">
    <asp:Label ID="PageNameLabel" runat="server" CssClass="PageNameContentStyle"></asp:Label>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div class="basic_element">
    <div class="red_title">
        <asp:Label ID="CompletedMatchesTitleLabel" runat="server" Text="<%$ Resources:Resource, Global_CompletedMatches %>" CssClass="white_title" ></asp:Label>
    </div>
    <div class="padding5">
    <asp:HiddenField ID="IsNationalTeamHiddenField" runat="server" />
    <asp:HiddenField ID="AreYousureAssign1" runat="server" Value="<%$ Resources:Resource, TeamListOfMatches_AssignStadiumApprovalPart1 %>" />
    <asp:HiddenField ID="AreYousureAssign2" runat="server" Value="<%$ Resources:Resource, TeamListOfMatches_AssignStadiumApprovalPart2 %>" />
    <asp:Panel ID="ConfirmPanel" runat="server" Visible="false">
        <asp:Label ID="ConfirmNote" runat="server" Text="" SkinID="GreenSmallHeaderLabel"></asp:Label>
        <br /><br />
    </asp:Panel>   
    <asp:GridView ID="CompletedMatchesGridView" runat="server" DataSourceID="CompletedMatchesSqlDataSource"
        SkinID="Professional" OnRowCommand="CompletedMatchesGridView_RowCommand" AutoGenerateColumns="False"
        AllowPaging="True" EnableTheming="True" BorderWidth="0">
        <Columns>
            <asp:TemplateField>
                <HeaderTemplate>
                    &nbsp;
                    <asp:Label ID="TimeHeaderTitleLabel" runat="server" Text="<%$ Resources:Resource, Global_Time %>"></asp:Label>
                </HeaderTemplate>
                <ItemTemplate>
                    <div style="padding:3px;">
                        <asp:Label ID="TimeLabel" runat="server" Text='<%# Eval("Time")%>' SkinID="GridLabel"> </asp:Label>
                    </div>
                </ItemTemplate>
                <ItemStyle BorderWidth="0" Width="20%" />
            </asp:TemplateField>
            <asp:TemplateField ItemStyle-Width="4%">
                <ItemTemplate>
                    <asp:Image ID="MatchTypeImage" runat="server" ImageUrl='<%# GetNivdalData.GetNivdalData.GetIconByMatchType(Eval("Type"), (bool)Eval("IsBonusPromotionsMatch")) %>' 
                     ToolTip='<%# GetNivdalData.GetNivdalData.GetToolTipByMatchType(Eval("Type"), (bool)Eval("IsBonusPromotionsMatch")) %>' />
                </ItemTemplate>       
                <ItemStyle BorderWidth="0" />       
            </asp:TemplateField>
            <asp:TemplateField ItemStyle-Width="45%">
                <ItemTemplate>
                    <asp:HyperLink ID="MatchTitleHyperLink" runat="server" Text='<%# Eval("MatchTitle") %>'
                        NavigateUrl='<%# Eval("MatchId", "MatchPage.aspx?MatchId={0}") %>' SkinID="BlackHyperLinkSkin"></asp:HyperLink>
                </ItemTemplate>
                <ItemStyle BorderWidth="0" />
            </asp:TemplateField>
            <asp:TemplateField ItemStyle-Width="10%">
                <HeaderTemplate>
                    <asp:Label ID="ScoreHeaderLabel" runat="server" Text="<%$ Resources:Resource, ListOfTeamMatches_ScoreHeaderLabel %>"></asp:Label>
                </HeaderTemplate>
                <ItemTemplate>
                    <asp:Label ID="ScoreLabel" runat="server" Text='<%# Eval("Score") %>' SkinID="GridLabel"></asp:Label>
                </ItemTemplate>  
                <ItemStyle BorderWidth="0" />         
            </asp:TemplateField>            
            <asp:TemplateField ItemStyle-Width="17%">
                <ItemTemplate>
                    <asp:HyperLink ID="ShowRatingsHyperLink" runat="server" NavigateUrl='<%# "~/MatchRatings.aspx?MatchId=" + Eval("MatchId") %>'
                        Text="<%$ Resources:Resource, ListOfTeamMatches_ShowRatingsHyperLink %>" SkinID="BlackHyperLinkSkin">
                    </asp:HyperLink>
                </ItemTemplate>
                <ItemStyle BorderWidth="0" />
                <HeaderStyle BorderWidth="0" />
            </asp:TemplateField>
            <asp:TemplateField ItemStyle-Width="4%">
                <ItemTemplate>
                    <asp:ImageButton ID="BookmarkLinkButton1" runat="server" Visible='<%# IsAllowBookMark() %>' ImageUrl="~/Images/bookmarks.png" ToolTip="<%$ Resources:Resource, MatchPage_BookmarkLinkButtonToolTip %>"
                    CommandArgument='<%# Eval("MatchId") %>' CommandName="BookmarkMatch"></asp:ImageButton>
                    
                </ItemTemplate>
                <HeaderStyle BorderWidth="0" />
                <ItemStyle BorderWidth="0" />
            </asp:TemplateField>
        </Columns>
        <EmptyDataTemplate>
            This team did not play any match recently
        </EmptyDataTemplate>
    </asp:GridView>
    <asp:SqlDataSource ID="CompletedMatchesSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        SelectCommand="Nivdal_GetTopCompletedMatchesForTeam" SelectCommandType="StoredProcedure">
    </asp:SqlDataSource>
    </div>
    </div>
    
    <asp:Panel ID="OngoingMatchesPanel" runat="server">
    <div class="basic_element">
    <div class="red_title">
        <asp:Label ID="OngoingMatchesLabel" runat="server" Text="<%$ Resources:Resource, ListOfTeamMatches_OngoingMatchesLabel %>" CssClass="white_title"></asp:Label>
    </div>
    <div class="padding5">
    
    
    <asp:GridView ID="OngoingMatchForTeamGridView" runat="server" DataSourceID="OngoingMatchForTeamSqlDataSource"
        SkinID="Professional" OnRowCommand="OngoingMatchForTeamGridView_RowCommand" AutoGenerateColumns="False"
        AllowPaging="True" EnableTheming="True">
        
        <Columns>
            <asp:TemplateField ItemStyle-Width="4%">
                <ItemTemplate>
                    <div style="padding: 3px;">
                        <asp:Image ID="MatchTypeImage" runat="server" ImageUrl='<%# GetNivdalData.GetNivdalData.GetIconByMatchType(Eval("Type"), (bool)Eval("IsBonusPromotionsMatch")) %>' 
                         ToolTip='<%# GetNivdalData.GetNivdalData.GetToolTipByMatchType(Eval("Type"), (bool)Eval("IsBonusPromotionsMatch")) %>' />
                    </div>
                </ItemTemplate>
                <ItemStyle BorderWidth="0" />
                <HeaderStyle BorderWidth="0"/>
            </asp:TemplateField>
            <asp:TemplateField ItemStyle-Width="68%">
                <ItemTemplate>
                    <asp:HyperLink ID="MatchTitleHyperLink" runat="server" Text='<%# Eval("MatchTitle") %>'
                        NavigateUrl='<%# Eval("MatchId", "MatchPage.aspx?MatchId={0}") %>' SkinID="BlackHyperLinkSkin"></asp:HyperLink>
                </ItemTemplate>
                <ItemStyle BorderWidth="0" />
                <HeaderStyle BorderWidth="0"  />
            </asp:TemplateField>
            <asp:TemplateField  ItemStyle-Width="20%">
                <ItemTemplate>
                    <asp:Label ID="ResultLabel" runat="server" Text='<%# Eval("Result") %>' SkinID="GridLabel"></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField ItemStyle-Width="8%">
                <ItemTemplate>
                    <asp:ImageButton ID="LiveImageButton" runat="server" CommandName="AddToLive" CommandArgument='<%# Eval("MatchId") %>'
                     ImageUrl="~/Images/Icons/LiveDetails.png" ToolTip="<%$ Resources:Resource, Live_AddMatchToLiveText %>" />
                    <asp:ImageButton ID="BookmarkLinkButton1" runat="server" ToolTip="<%$ Resources:Resource, MatchPage_BookmarkLinkButtonToolTip %>"
                        CommandArgument='<%# Eval("MatchId") %>' CommandName="BookmarkMatch" Visible='<%# IsAllowBookMark() %>'
                        ImageUrl="~/Images/bookmarks.png"></asp:ImageButton>                   
                </ItemTemplate>
                <ItemStyle BorderWidth="0" />
                <HeaderStyle BorderWidth="0" />
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="OngoingMatchForTeamSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        SelectCommand="Nivdal_GetOngoingMatchForTeam" SelectCommandType="StoredProcedure">
    </asp:SqlDataSource>
    </div>
    </div>
    
    </asp:Panel>
    <div class="basic_element">
    <div class="red_title">
        <asp:Image ID="HelpTextImage" runat="server" ImageUrl="~/Images/question.gif" class="floater" />
        <cc1:Flyout ID="Allow15MinutesFlyout" runat="server" AttachTo="HelpTextImage" Align="LEFT" NoneEffect="true" Position="TOP_CENTER">
            <div class="ToolTipStyle">
                <asp:Label ID="FifteenMinutesFlyoutLabel" runat="server" Text="<%$ Resources:Resource, ListOfTeamMatches_HelpTextImage %>"></asp:Label>
            </div>
        </cc1:Flyout>
        <asp:Label ID="UpcomingMatchesLabel" runat="server" Text="<%$ Resources:Resource, ListOfTeamMatches_UpcomingMatchesLabel %>" CssClass="white_title"></asp:Label>
        
    </div>
    <div class="padding5">
    
        <asp:GridView ID="UpcomingMatchesGridView" runat="server" DataSourceID="UpcomingMatchesSqlDataSource"
            SkinID="Professional" OnRowCommand="UpcomingMatchesGridView_RowCommand" AutoGenerateColumns="False"
            OnRowCreated="UpcomingMatchesGridView_OnRowCreated" AllowPaging="True" EnableTheming="True">
            <Columns>
                <asp:BoundField DataField="MatchId" Visible="true" />
                <asp:TemplateField ItemStyle-Width="20%">
                    <HeaderTemplate>
                        <asp:Label ID="TimeHeaderlabel" runat="server" Text="<%$ Resources:Resource, Global_Time %>"></asp:Label>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <div style="padding:3px;">
                            <asp:Label ID="TimeLabel" runat="server" Text='<%# Eval("Time")%>' SkinID="GridLabel"> </asp:Label>
                        </div>
                    </ItemTemplate>
                </asp:TemplateField> 
                <asp:TemplateField ItemStyle-Width="4%">
                    <ItemTemplate>
                        <asp:Image ID="MatchTypeImage" runat="server" ImageUrl='<%# GetNivdalData.GetNivdalData.GetIconByMatchType(Eval("Type"), (bool)Eval("IsBonusPromotionsMatch")) %>' 
                         ToolTip='<%# GetNivdalData.GetNivdalData.GetToolTipByMatchType(Eval("Type"), (bool)Eval("IsBonusPromotionsMatch")) %>' />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField ItemStyle-Width="36%">
                    <ItemTemplate>
                        <asp:HyperLink ID="TitleHyperLink" runat="server" Text='<%# Eval("Title") %>' NavigateUrl='<%# Eval("MatchId", "MatchPage.aspx?MatchId={0}") %>'
                            SkinID="BlackHyperLinkSkin"></asp:HyperLink>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField ItemStyle-Width="32%">
                    <HeaderTemplate>
                        <asp:Label ID="StadiumNameTitleLabel" runat="server" Text="<%$ Resources:Resource, ListOfTeamMatches_StadiumNameTitleLabel %>"></asp:Label>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:HyperLink ID="StadiumNameHyperLink" runat="server" Text='<%# Eval("StadiumName") %>'
                            NavigateUrl='<%# Eval("StadiumId", "StadiumPage.aspx?StadiumId={0}") %>' SkinID="BlackHyperLinkSkin"></asp:HyperLink>
                        
                        <asp:Panel ID="StadiumAssignmentPanel" runat="server" Visible='<%# IsStadiumAsignment(Eval("StadiumAsignment"))%>'>                        
                            <asp:DropDownList ID="StadiumsDropDownList" Enabled="True" Width="140"
                                AppendDataBoundItems="true" DataSourceID="ShowStadiumsValuesSqlDataSource" DataTextField="StadiumName"
                                DataValueField="StadiumId" runat="server" CssClass="rounded_corners">
                            </asp:DropDownList>
                            <asp:Image ID="StadiumCostsImage" runat="server" ImageUrl="~/Images/question.gif" />
                            <asp:ImageButton ID="AssignStadiumImageButton" runat="server" message="<%$ Resources:Resource, AreYouSure %>"
                            OnClientClick='return confirm(this.getAttribute("message"))'
                            CommandArgument="<%#((GridViewRow) Container).RowIndex %>" CommandName="AssignStadium"
                            ToolTip="<%$ Resources:Resource, Global_AssignStadium %>" ImageUrl="~/Images/Icons/vi.png" />
                            <%--<asp:ImageButton ID="AssignStadiumImageButton" runat="server" message="<%$ Resources:Resource, AreYouSure %>"
                             CommandArgument="<%#((GridViewRow) Container).RowIndex %>" CommandName="AssignStadium"
                             ToolTip="<%$ Resources:Resource, Global_AssignStadium %>" ImageUrl="~/Images/Icons/vi.png" />--%>
                            <cc1:Flyout ID="StadiumCostsFlyout" runat="server" AttachTo="StadiumCostsImage" NoneEffect="true" 
                            Position="BOTTOM_CENTER">
                                <div class="ToolTipStyle" style="width:300px;">
                                    <asp:Label ID="StadiumCostsTitleLabel" runat="server" SkinID="InfoLabel"
                                     Text="<%$ Resources:Resource, ListOfTeamMatches_StadiumCostsTitleLabelText %>"></asp:Label>
                                     <br />
                                    <asp:GridView ID="StadiumsCostGridView" runat="server" DataSourceID="StadiumsCostSQLDataSourse"
                                     SkinID="Professional" AllowPaging="false" AutoGenerateColumns="false">
                                        <Columns>
                                            <asp:TemplateField>
                                                <ItemTemplate>
                                                   <asp:Label ID="StadiumNameLabel" runat="server" Text='<%# Eval("Name") %>' SkinID="InfoLabel"></asp:Label> 
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField>
                                                <ItemTemplate>
                                                    <asp:Label ID="StadiumCostLabel" runat="server" Text='<%# Eval("Cost") %>'></asp:Label>
                                                    <asp:Image ID="AtukImage" runat="server" ImageUrl="~/Images/Icons/atuk.png"
                                                     ToolTip="<%$ Resources:Resource, Atuks %>"/>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                        </Columns>
                                    </asp:GridView>
                                </div>                        
                            </cc1:Flyout>
                        
                        </asp:Panel>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField ItemStyle-Width="4%">
                    <ItemTemplate>
                        <%--<asp:ImageButton ID="AssignInstructionsLinkButton" runat="server" 
                        ImageUrl='<%# Eval("InstructionIconName", "~/Images/Icons/{0}") %>' 
                        PostBackUrl='<%# Eval("IstructionsPageName") + "?MatchId=" + Eval("MatchId")%>'
                        ToolTip='<%# Eval("ShowAssignInstructionsString") %>'
                        Visible='<%# Eval("InstructionsVisible") %>'/>--%>
                        <asp:ImageButton ID="AssignInstructionsLinkButton" runat="server" 
                        ImageUrl='<%# Eval("InstructionIconName", "~/Images/Icons/{0}") %>' 
                        PostBackUrl='<%# "~/MatchInstructions_New.aspx?MatchId=" + Eval("MatchId") %>'
                        ToolTip='<%# Eval("ShowAssignInstructionsString") %>'
                        Visible='<%# Eval("InstructionsVisible") %>'/>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField ItemStyle-Width="4%">
                    <ItemTemplate>
                        <asp:ImageButton ID="AddToLiveButton" runat="server" ImageUrl="~/Images/Icons/LiveDetails.png" ToolTip="<%$ Resources:Resource, Live_AddMatchToLiveText %>"
                         CommandName="AddToLive" CommandArgument='<%# Eval("MatchId") %>' Visible='<%# IsAllowedLive(Eval("CanAddToLive")) %>' />
                         <asp:ImageButton ID="BookmarkLinkButton1" runat="server" ToolTip="<%$ Resources:Resource, MatchPage_BookmarkLinkButtonToolTip %>"
                            CommandArgument='<%# Eval("MatchId") %>' CommandName="BookmarkMatch" Visible='<%# IsAllowBookMark() %>'
                            ImageUrl="~/Images/bookmarks.png"></asp:ImageButton>                    
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <EmptyDataTemplate>
                No matches planned for this team yet
            </EmptyDataTemplate>
        </asp:GridView>
        <asp:SqlDataSource ID="UpcomingMatchesSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            SelectCommand="Nivdal_GetTopUpcomingMatches" SelectCommandType="StoredProcedure">
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="ShowStadiumsValuesSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            SelectCommand="Nivdal_GetStadiumsDDLForMatch" SelectCommandType="StoredProcedure">
        </asp:SqlDataSource>
         <asp:SqlDataSource ID="StadiumsCostSQLDataSourse" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            SelectCommand="Nivdal_GetStadumCostsForMatch" SelectCommandType="StoredProcedure">
        </asp:SqlDataSource>
        <br />
        <asp:Hyperlink ID="FutureMatchesLinkButton" runat="server" Text="<%$ Resources:Resource, ListOfTeamMatches_FutureMatchesLinkButton %>"
        SkinID="GreenTitleHyperLink"></asp:Hyperlink>
        <br />
        <br />
        <asp:Hyperlink ID="PastMatchesLinkButton" runat="server" Text="<%$ Resources:Resource, ListOfTeamMatches_PastMatchesLinkButton %>"
            SkinID="GreenTitleHyperLink"></asp:Hyperlink>
        <br />
        <br />
        <asp:Hyperlink ID="TeamHomePageLinkButton" runat="server" Text="<%$ Resources:Resource, Global_TeamHomePage %>"
            SkinID="GreenTitleHyperLink"></asp:Hyperlink>
    </div>
    </div>
    
</asp:Content>
